package com.scut.edu.wanyou.channel;

import java.security.PublicKey;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.security.auth.PrivateCredentialPermission;

import com.scut.edu.wanyou.R;
import com.scut.edu.wanyou.R.id;
import com.scut.edu.wanyou.TempValue;
import com.scut.edu.wanyou.wanwanstool.DragListView;
import com.scut.edu.wanyou.wanwanstool.Wanwan;
import com.scut.edu.wanyou.wanwanstool.wanwanAdapter;

import android.R.string;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.location.GpsStatus.Listener;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.View.OnFocusChangeListener;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class WanwanListActivity extends Activity implements OnItemClickListener{

    DragListView listView;
    List<Wanwan> wanwans=new ArrayList<Wanwan>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
    	requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.wanwan_list_activity);
        prepareView();
    }

    private void prepareView() {
        Wanwan wanwan;
        wanwan=new Wanwan(1,1);
    	wanwan.setUserNickname("也让我斩个魂");
    	wanwan.setStartTime("2013-05-01");
    	wanwan.setEndTime("2013-05-12");
    	wanwan.setStatu("还有9天结束");
    	wanwan.setLocation("岭南印象园");
    	wanwan.setPublishTime("4月8日 20:59");
    	wanwan.setTitle("斩魂-广州玩友聚会");
    	wanwan.setDetails("《斩魂》为网易耗时3年倾情开发的3D大型闯关格斗网游。以隋唐历史结合上古神话的幻想题材为背景；兼顾高分辨率3D写实画面与全面升级的“3D化格斗”打击操作体验");
        wanwan.setInterested(123);
        wanwan.setJoined(92);
    	
    	wanwans.add(wanwan);
        
        wanwan=new Wanwan(2,1);
    	wanwan.setUserNickname("魔影亚沙");
    	wanwan.setStartTime("2013-05-01");
    	wanwan.setEndTime("2013-05-12");
    	wanwan.setStatu("还有3天结束");
    	wanwan.setLocation("天河体育馆");
    	wanwan.setPublishTime("5月1日 13:15");
    	wanwan.setTitle("钢铁侠3上映");
    	wanwan.setDetails("《钢铁侠2》全球票房大捷自然让《钢铁侠3》进入到了考虑范围之中。2012年4月16日，DMG娱乐传媒集团在京举行发布会，宣布将与美国漫威影业强强联手");
    	wanwan.setDetailsImageUrl("图片");
    	wanwan.setInterested(2227);
        wanwan.setJoined(1822);
    	wanwans.add(wanwan);
        
        wanwan=new Wanwan(1,2);
    	wanwan.setUserNickname("我是陈强");
    	wanwan.setStartTime("2013-05-01");
    	wanwan.setEndTime("2013-05-12");
    	wanwan.setStatu("还有6天结束");
    	wanwan.setLocation("大学城华南理工大学C12");
    	wanwan.setPublishTime("5月1日 01:22");
    	wanwan.setTitle("宿舍内务检查");
    	wanwan.setDetails("检查玩游戏情况");
    	wanwan.setInterested(187);
        wanwan.setJoined(23);
        wanwans.add(wanwan);
        
        wanwanAdapter adapter=new wanwanAdapter(this, wanwans);
        listView = (DragListView)findViewById(R.id.movieList);
        listView.setAdapter(adapter);
        listView.setDivider(null);
        listView.setDividerHeight(8);
        listView.setOnItemClickListener(this);
    }


	@Override
	public void onItemClick(AdapterView<?> arg0, View view, int pos, long arg3) {
		// TODO Auto-generated method stub
		Intent intent =new Intent();
		intent.setClass(this, WanwanActivity.class);
		intent.putExtra("act_id", wanwans.get(pos-1).getActID());
		startActivity(intent);
	}
    
}
